//
//  ViewController.m
//  UnderLinerTextField
//
//  Created by ZJ on 2018/5/23.
//  Copyright © 2018年 iCatch Technology Inc. All rights reserved.
//

#import "ViewController.h"
#import "UnderLineTextField.h"

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UITextField *phoneField;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
//    [self setupGUI];
    UnderLineTextField *tf = [[UnderLineTextField alloc] initWithFrame:CGRectMake(20, 200, 320, 45)];
    tf.lineColor = [UIColor redColor];
    tf.lineWidth = 2;
    
    tf.placeholder = @"hahhah";
    [self.view addSubview:tf];
}

- (void)setupGUI {
    self.phoneField.borderStyle = UITextBorderStyleNone;
    self.phoneField.font = [UIFont systemFontOfSize:15];
    self.phoneField.placeholder = @"请输入手机号";
    UIView *line = [[UIView alloc]initWithFrame:CGRectMake(0, self.phoneField.frame.size.height, self.phoneField.frame.size.width - 60, 1)];
    line.backgroundColor = [UIColor blueColor];
    [self.phoneField addSubview:line];
    
    // 通过init来创建初始化绝大部分控件，控件都是没有尺寸
//    UIImageView *searchIcon = [[UIImageView alloc] init];
////    searchIcon.image = [UIImage imageNamed:@"phone"];
//    searchIcon.backgroundColor = [UIColor redColor];
//    searchIcon.bounds = CGRectMake(0, 0, 30, 30);
//    searchIcon.contentMode = UIViewContentModeCenter;
//    self.phoneField.leftView = searchIcon;
//    self.phoneField.leftViewMode = UITextFieldViewModeAlways;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
